﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Entity;

namespace WoChu.RfClient.Duty
{
    public class DutyUIRule
    {
        private static DutyUIRule _NewInstance = new DutyUIRule();

        public static DutyUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new DutyUIRule();
                }

                return _NewInstance;
            }
        }


        public ResultModel<List<WarehouseInfo>> GetPDAWarehouse(string warehouseDate)
        {
            try
            {
                ResultModel<List<WarehouseInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<ResultModel<List<WarehouseInfo>>>("GetPDAWarehouse", new object[] { warehouseDate });
                if (_result == null)
                    return new ResultModel<List<WarehouseInfo>>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<List<WarehouseInfo>>().GetInstance();
            }
        }


        public ResultModel<int> UpdatePDAWarehouseState(string warehouseDate, string userID)
        {
            try
            {
                ResultModel<int> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<ResultModel<int>>("UpdatePDAWarehouseState", new object[] { warehouseDate, userID });
                if (_result == null)
                    return new ResultModel<int>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }

            return null;
        }

        public ResultModel<int> UpdatePDAWarehouseQty(string userID, List<WarehouseInfo> lstWarehouse)
        {
            ResultModel<int> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<List<WarehouseInfo>, ResultModel < int>>("UpdatePDAWarehouseQty", new object[] { userID }, lstWarehouse);
            if (_result == null)
                return new ResultModel<int>().GetInstance();
            return _result;
        }


        public ResultModel<List<string>> GetPDAWarehouseName(string userID)
        {
            ResultModel<List<string>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod < ResultModel<List<string>>>("GetPDAWarehouseName", new object[] { userID });
            if (_result == null)
                return new ResultModel<List<string>>().GetInstance();
            return _result;
        }

        public ResultModel<List<string>> GetPDAPickBatchNo(string userID)
        {
            ResultModel<List<string>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod < ResultModel<List<string>>>("GetPDAPickBatchNo", new object[] { userID });
            if (_result == null)
                return new ResultModel<List<string>>().GetInstance();
            return _result;
        }

        public ResultModel<PickInfo> GetPDAPickInfo(string batchNo, string warehouseName, string userID)
        {
            ResultModel<PickInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<ResultModel<PickInfo>>("GetPDAPickInfo", new object[] { batchNo, warehouseName, userID });
            if (_result == null)
                return new ResultModel<PickInfo>().GetInstance();
            return _result;
        }

        public ResultModel<List<PickItemInfo>> GetPDAPickItemInfo(string pickID)
        {
            ResultModel<List<PickItemInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod < ResultModel<List<PickItemInfo>>>("GetPDAPickItemInfo", new object[] { pickID });
            if (_result == null)
                return new ResultModel<List<PickItemInfo>>().GetInstance();
            return _result;
        }

        public ResultModel<bool> SubmitPDAPick(string pickID, string batchDate, string state, string userID, List<PickItemInfo> lstPickItem)
        {
            ResultModel<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<List<PickItemInfo>, ResultModel<bool>>("SubmitPDAPick", new object[] { pickID, batchDate, state, userID }, lstPickItem);
            if (_result == null)
                return new ResultModel<bool>().GetInstance();
            return _result;
        }

        public ResultModel<bool> SavePDAPick(string userID, List<PickItemInfo> lstPickItem)
        {
            ResultModel<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IDuty>.NewInstance.InvokeWebMethod<List<PickItemInfo>, ResultModel<bool>>("SavePDAPick", new object[] { userID }, lstPickItem);
            if (_result == null)
                return new ResultModel<bool>().GetInstance();
            return _result;
        }



     
    }
}
